package com.itestor.iptv.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author masaki
 *
 */
public class FileReadUtil {
	public static Map<String,String> readFile(String fileName) throws IOException{
		Map<String, String> returnMap = new HashMap<String, String>();
		BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));
		String line = "";
        while (null != (line = bufferedReader.readLine())) {
        	if(line.split("=").length!=2){
        		return null;
        	}
        	if("".equals(line.split("=")[0].trim())){
        		return null;
        	}
        	if("".equals(line.split("=")[1].trim())){
        		return null;
        	}
        	returnMap.put(line.split("=")[0].trim(),line.split("=")[1].trim());;
        }
		return returnMap;
	}
}
